{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">头像：</label>
                            <div class="layui-input-block">
                                <div class="layui-upload-list">
                                    <img class="layui-append-img" src="{$data.user_image}" onerror="this.src='/static/admin/images/no_img.jpg'">
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">身份：</label>
                            <div class="layui-input-block">
                                {$data.is_vip|is_vip}&emsp;&emsp;
                                {equal name="$data.is_vip" value="1"}
                                    <a href="{:url('admin/member/up_vip',['user_id'=>$data.user_id])}" class="layui-btn layui-btn-radius layui-btn-sm layui-btn-normal">给他升级成会员<i class="layui-icon">&#xe609;</i> </a>
                                {/equal}
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户ID：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_id" value="{$data.user_id}" lay-verify="required" placeholder="名称" class="layui-input layui-btn-disabled" readonly>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">用户名：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_username" value="{$data.user_username}" lay-verify="required" placeholder="名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">昵称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_nickname" value="{$data.user_nickname}" lay-verify="required" placeholder="名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">手机号码：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_phone" value="{$data.user_phone}" lay-verify="required" placeholder="名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">年龄：</label>
                            <div class="layui-input-block">
                                <input type="text" name="user_age" value="{$data.user_age}" lay-verify="required" placeholder="名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">出生日期：</label>
                            <div class="layui-input-block">
                                {$data.user_birthday}
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">注册日期：</label>
                            <div class="layui-input-block">
                                {$data.user_time}
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">归属地：</label>
                            <div class="layui-input-block">
                                {$area}
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">性别：</label>
                            <div class="layui-input-block">
                                <select name="user_gender">
                                    <option value="1" {equal name="$data.user_gender" value="1"} selected {/equal}>男</option>
                                    <option value="2" {equal name="$data.user_gender" value="2"} selected {/equal}>女</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">状态：</label>
                            <div class="layui-input-block">
                                <select name="user_status">
                                    <option value="1" {equal name="$data.user_status" value="1"} selected {/equal}>正常</option>
                                    <option value="2" {equal name="$data.user_status" value="2"} selected {/equal}>拒绝</option>
                                    <option value="3" {equal name="$data.user_status" value="3"} selected {/equal}>冻结</option>
                                    <option value="4" {equal name="$data.user_status" value="4"} selected {/equal}>已删除</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">更新
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //    var editor = wk.wang({elem:'#LAY_editor'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;
//        form.verify({
//            editor:function(value,item){
//                if(editor.txt.html() == '<p><br></p>'){
//                    return '请填写内容';
//                }
//            }
//        });
        form.on('submit(component-form-element)', function (data) {
//            data.field.new_content = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('admin/member/update')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    // console.log(res);
                    if (res.data == 1) {
                        wk.success(res.message,"{:url('member/index')}")
                    } else {
                        wk.error(res.message,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });

        var laydate = layui.laydate;
        //同时绑定多个
        lay('.test-item').each(function(){
            laydate.render({
                elem: this
                ,format:'yyyy-MM-dd'
                ,type:'date'
                ,trigger: 'click'
            });
        });
//        form.on('select(role)', function(data){
//            if(data.value == 1){
//                $(".banner_link").removeClass('hidden');
//                $(".banner_cate").addClass('hidden');
//                $(".banner_new").addClass('hidden');
//            }else{
//                $(".banner_link").addClass('hidden');
//                $(".banner_cate").removeClass('hidden');
//                if(banner_cate == 3){
//                    $(".banner_new").removeClass('hidden');
//                }
//            }
//        });
//        form.on('select(role1)', function(data){
//            banner_cate = data.value;
//            if(data.value == 1){
//                $('.banner_new').addClass('hidden');
//            }else if(data.value == 2){
//                $('.banner_new').addClass('hidden');
//            }else {
//                $('.banner_new').removeClass('hidden');
//            }
//        });
    });
</script>

</body>
</html>
